package CustomUI;

import java.util.ArrayList;

import com.example.dworld3.Drawings;
import com.ydev.dworld3.R;

import android.app.ProgressDialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

public class ydDrawingsAdapter extends BaseAdapter {
	
	private Context context;
	private String[] mobileValues;
	
	ArrayList<Integer> drawingIDs;
	
	
	public ydDrawingsAdapter(Context context, String[] mobileValues) {
		this.context = context;
		this.mobileValues = mobileValues;
	}

	public ydDrawingsAdapter(Context context, ArrayList<Integer> drawingIDs) {
		this.context = context;
		this.drawingIDs = drawingIDs;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	
			View gridView;
	
			if (convertView == null) {
	
				gridView = new View(context);
	
				// get layout from mobile.xml
				gridView = inflater.inflate(R.layout.drawing_cell, null);
				
	
/*				// set value into textview
				TextView textView = (TextView) gridView
						.findViewById(R.id.grid_item_label);
				textView.setText(mobileValues[position]);
	
				// set image based on selected text
				ImageView imageView = (ImageView) gridView
						.findViewById(R.id.grid_item_image);
	
				String mobile = mobileValues[position];
	
				if (mobile.equals("Windows")) {
					imageView.setImageResource(R.drawable.anchor_fixed);
				} else if (mobile.equals("iOS")) {
					imageView.setImageResource(R.drawable.anchor_pivot);
				} else if (mobile.equals("Blackberry")) {
					imageView.setImageResource(R.drawable.arrow_e_normal);
				} else {
					imageView.setImageResource(R.drawable.arrow_se_pressed);
				}*/
	
			} else {
				gridView = (View) convertView;
			}
	
			return gridView;
	}

	@Override
	public int getCount() {
		return drawingIDs.size();
	}
 
	@Override
	public Object getItem(int position) {
		return null;
	}
 
	@Override
	public long getItemId(int position) {
		return 0;
	}

}
